// ****************************************************************************
//
// Logic 6: Swampy's Checkpoint
//
// ****************************************************************************

#include "defines.txt"

if (new_room) {
  load.pic(room_no);
  draw.pic(room_no);
  discard.pic(room_no);
  set.horizon(37);

  // The next 6 lines need only be in the first room of the game
 /* if ((prev_room_no == 1 ||    // just come from intro screen
      prev_room_no == 0)) {    // or just started game
    position(ego,120,140);
    status.line.on();
    accept.input();
  }*/

// Check what room the player came from and position them on the
// screen accordingly here, e.g:
// if (prev_room_no == 5) {
//   position(ego,12,140);
// }

  draw(ego);
  show.pic();
}

animate.obj(o14);
load.view(7);
set.view(o14,7);
position(o14,86,126);
draw(o14);

if (said("look")) {
  print("This is Swampy's Checkpoint.  Swampy is the troglodyte in the green loincloth.");
  print("At least you hope it's a loincloth.");
}

if (isset(ego_touching_signal_line) && (!isset(swampy_asleep))){
    print("\"Hey!  You can't go past!\"");
    print("You're going to have to figure out another way through.");
    move.obj(o0,39,109,1,done_flag);
    }

if ((said("give","swampy","poison") ||
    said("give","guy","poison") ||
    said("give","poison","swampy") ||
    said("give","poison","guy") ||
    said("give","poison"))) {
     if (has("poison")){
     drop("poison");
     print("\"Mmm... that's good!  Got anymore?\"");
     }
     else{print("You don't have any.");}
    }

if ((said("give","swampy","sleeping potion") ||
    said("give","guy","sleeping potion") ||
    said("give","sleeping potion","swampy") ||
    said("give","sleeping potion","guy") ||
    said("give","sleeping potion"))) {
     if (has("sleep potion")) {
      if (!swampy_asleep) {
      drop("sleep potion");
      print("Swampy drinks the potion and nods off to sleep.");
      set(swampy_asleep);
      set.loop(o14,1);
      }
      else {print("He's already asleep.");}
      }
     else {print("But you have none to give...  dumbass.");}
    }

if ((said("talk","swampy") ||
    said("talk","guy")) &&
    !isset(swampy_asleep)) {
    print("Dang, girl...   Guarding this here checkpoint makes a man awful thirsty.");
    }

if ((said("look","swampy") ||
    said("look","guy"))) {
     print("This is Swampy.  Swampy could squeeze blood from a stone.  Who knows what he could do to you if you crossed him.");
     }

if ((said("look","loincloth") ||
    said("look","anyword","loincloth"))) {
      print("You'd rather not look too close.");
      }

if (ego_edge_code == right_edge) {    // ego touching right edge of screen
  new.room(10);
}

if (ego_edge_code == left_edge) {     // ego touching left edge of screen
  new.room(3);
}

return();